package dao;

import pojo.NormalUser;
import sql.BaseUtil;

import java.sql.ResultSet;

public class UserDao extends BaseUtil {
    public NormalUser selectByNameAndPassword(String name, String password) throws Exception {
        String sql = "select * from user where username = ? and password = ?";
        Object [] obj = {name,password};

        ResultSet select = this.select(sql, obj);
        NormalUser user =null;
        while (select.next()){
            user = new NormalUser(select.getString("username"));
            user.setPassword(select.getString("password"));
            user.setMater(select.getInt("mater"));
            user.setId(select.getInt("id"));
        }

        return user;

    }
}
